package cate.game.play.part;

import cate.game.attr.FightAttr;
import cp.solution.util.collection.ListKit;
import easy.java.dev.note.NoteClass;
import easy.java.dev.note.NoteField;
import lombok.Data;

import java.util.ArrayList;
import java.util.List;

@NoteClass("上阵的战斗者")
@Data
public abstract class BattleFighter<T extends BattleFighter> {

	@NoteField("属性")
	protected FightAttr attr = new FightAttr();

	@NoteField("技能")
	protected List<Integer> skills = new ArrayList<>();

	@NoteField("pvp属性")
	protected FightAttr pvpAttr = new FightAttr();

	@NoteField("pvp技能")
	protected List<Integer> pvpSkills = new ArrayList<>();

	@NoteField("战力")
	public long power;


	public void readFrom(T tar) {
		this.attr = tar.attr.copy();
		this.skills = ListKit.cloneList(tar.skills, Integer::intValue);
		this.pvpAttr = tar.pvpAttr.copy();
		this.pvpSkills = ListKit.cloneList(tar.pvpSkills, Integer::intValue);
		this.power = tar.power;
	}

	public void addAttr(FightAttr exAttr) {
		this.attr.add(exAttr);
	}

	public void addSkills(List<Integer> exSkills) {
		this.skills.addAll(exSkills);
	}
}
